import loading from '@/components/loading'

export default {
  data () {
    return {
      usermes: {
        name:'',
        tel:'',
        age:'',
        sex:'',
        introduce:'',
        store:''
      },
    }
  },
  components:{
    loading
  },
  methods: {
    openUpadta:function(){
      this.usermes = this.$store.state.loginmes;
    },
    submitUpadta:function () {
      var upadtaMsg=this.usermes;
      let self=this;
      this.$http.post(
        "/api/upUser",
        {
          upMsg:upadtaMsg,
        })
        .then(function (res) {
          console.log("请求成功");
          console.log(res);
          if(res.data.message=='success'){
            alert("修改成功");
            self.$store.state.loginmes=self.usermes;
          }else{
            alert("修改失败");
          }
        })
        .catch(function (err) {
          console.log(err);
          alert("修改失败")
        });
    }
  },
  mounted:function() {
    this.usermes = this.$store.state.loginmes;
  }
}
